#include <iostream>
#include <string>

#include "magicSingleton.h"
using namespace std;


class test
{
    //使MagicSingleton可以放问test类的构造函数
    friend class MagicSingleton<test>;
public:
    void show() { cout << "m_str " << m_str << endl; }

private:
    //防止用户实例化多个test类
    test(const std::string& str):m_str(str) {}
    test(const test&) {}
    test& operator=(const test)=delete;

private:
    std::string m_str;
};

int main(void)
{
    // 不需要在主线程中提前构造test了
    // MagicSingleton<test>::GetInstance();

    MagicSingleton<test>::GetInstance("hello world")->show();
    return 0;
}
